package com.wanmait.schedule.controller;

import com.github.pagehelper.PageInfo;
import com.wanmait.schedule.entity.Notice;
import com.wanmait.schedule.entity.NoticeRecord;
import com.wanmait.schedule.service.NoticeRecordService;
import com.wanmait.schedule.service.NoticeService;
import com.wanmait.schedule.util.AjaxResult;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/manage/noticeRecord")
public class NotificationController {
    @Resource
    private NoticeRecordService noticeRecordService;

    @Resource
    private NoticeService noticeService;
//    //获取通知列表
//    @PostMapping("list")
//    public AjaxResult list(Integer id, Integer status){
//        List<NoticeRecord> noticeRecordList = noticeRecordService.findNoticeById(id,status);
//        return AjaxResult.success("成功",noticeRecordList);
//    }

    //获取所有通知
    @GetMapping("notices")
    public AjaxResult notices(){
        List<Notice> noticeList = noticeService.notices();
        return AjaxResult.success("成功",noticeList);
    }

    @GetMapping("findByStudent")
    public AjaxResult findByStudent(Integer id,Integer pageNum){
        PageInfo<NoticeRecord> findBytudentList = noticeRecordService.findByStudent(id,pageNum);
        return AjaxResult.success("成功",findBytudentList);
    }
    @GetMapping("findByTeacher")
    public AjaxResult findByTeacher(Integer id,Integer pageNum){
        PageInfo<NoticeRecord> findByteacherList = noticeRecordService.findByTeacher(id,pageNum);
        return AjaxResult.success("成功",findByteacherList);
    }



}
